def jump(nums: list):
    farthest = steps = end = 0
    for i in range(len(nums) - 1):
        farthest = max(farthest, nums[i] + i)
        if end == i:
            steps += 1
            end = farthest
    return steps


if __name__ == '__main__':
    print(jump([2, 3, 1, 1, 4]))
